package com.jdk.demo.thread.threadpool;

import java.util.Random;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class PoolDemo5 {

	public static void main(String[] args) throws InterruptedException, ExecutionException {
		ExecutorService pool = Executors.newFixedThreadPool(2);
	    Random random = new Random();

	    for(int i=0; i<5; i++)	{
		    Future<String> f = pool.submit(new Callable<String>() {
				@Override
				public String call() throws Exception {
					Thread.sleep(5000);
					return "zsl";
				}
		    });
	    }
	}

}
